Inside Macintosh: QuickTime

Previous | Chapter Top | Chapter Contents | Next

Preferred Movie Settings

Every movie has default, or preferred, settings for playback rate and volume. These settings are stored with the movie in its movie file. The Movie Toolbox provides functions that allow your application to manipulate these default settings.

You can use the GetMoviePreferredRate and SetMoviePreferredRate functions to work with a movie's default playback rate. You can use the GetMoviePreferredVolume and SetMoviePreferredVolume functions to work with the default sound volume of a movie.

You can use the SetMovieRate function to change a movie's playback rate--see "Working with Movie Time," for a complete description of this function. The Movie Toolbox also provides a number of functions that allow you to change other settings when you play a movie. These functions are discussed in "Functions That Modify Movie Properties," .

SetMoviePreferredRate

The SetMoviePreferredRate function allows your application to specify a movie's default playback rate.

pascal void SetMoviePreferredRate (Movie theMovie, Fixed rate);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).
rate
Specifies the new movie rate as a 32-bit, fixed-point number. Positive integers indicate forward rates and negative integers indicate reverse rates.

DESCRIPTION

The default playback rate is the rate that the StartMovie function (described on StartMovie ) uses when it starts playing a movie. The default preferred rate of a movie is set to 1.0 (the kFix1 constant) when the movie is created.

SPECIAL CONSIDERATIONS

Do not set the preferred rate to 0.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

Your application can obtain the preferred playback rate by calling the GetMoviePreferredRate function, which is described in the next section.

You can set the current playback rate of a movie by calling the SetMovieRate function, which is described on SetMovieRate .

GetMoviePreferredRate

The GetMoviePreferredRate function returns a movie's default playback rate. This is the rate that the StartMovie function uses when it starts playing a movie.

pascal Fixed GetMoviePreferredRate (Movie theMovie);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

DESCRIPTION

The GetMoviePreferredRate function returns the default movie rate as a 32-bit, fixed-point number. Positive integers indicate forward rates and negative integers indicate reverse rates.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

Your application can change the preferred playback rate by calling the SetMoviePreferredRate function, which is described in the previous section. You can change the current playback rate of a movie by calling the SetMovieRate function, which is described on SetMovieRate .

SetMoviePreferredVolume

The SetMoviePreferredVolume function allows your application to set a movie's preferred volume setting.

pascal void SetMoviePreferredVolume (Movie theMovie,
                                          short volume);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).
volume
Specifies the preferred volume setting of the movie. The volume parameter must contain a 16-bit, fixed-point number that contains the movie's default volume. The high-order 8 bits contain the integer part of the value; the low-order 8 bits contain the fractional part. Volume values range from -1.0 to 1.0. Negative values play no sound but preserve the absolute value of the volume setting. You may find the following constants useful:
kFullVolume
Sets the movie to full volume (constant value is 1.0).
kNoVolume
Sets the movie to no volume (constant value is 0.0).

DESCRIPTION

Your application can obtain the preferred volume setting by calling the GetMoviePreferredVolume function, which is described in the next section. You can change a movie's current volume by calling the SetMovieVolume function, which is described on SetMovieVolume .

A movie's tracks may have their own volume settings. Use the SetTrackVolume function, described on SetTrackVolume , to set the volume of an individual track. A track's volume is scaled by the movie's volume to produce the track's final volume. Furthermore, the movie's volume is scaled by the sound volume that is returned by the Operating System's GetSoundVol routine (described in Inside Macintosh: More Macintosh Toolbox ). Thus, the user can control the overall volume from the Sound control panel.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

When a movie is loaded, the current setting is set to preferred volume. The StartMovie function (described on StartMovie ) uses this volume setting when it starts playing a movie.

GetMoviePreferredVolume

The GetMoviePreferredVolume function returns a movie's preferred volume setting.

pascal short GetMoviePreferredVolume (Movie theMovie);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie , NewMovieFromFile , and NewMovieFromHandle (described on NewMovie , NewMovieFromFile , and NewMovieFromHandle , respectively).

DESCRIPTION

The GetMoviePreferredVolume function returns a 16-bit, fixed-point number that contains the movie's default volume. The high-order 8 bits contain the integer part of the value; the low-order 8 bits contain the fractional part. Volume values range from 0.0 to 1.0.

You can change a movie's current volume by calling the SetMovieVolume function, which is described on SetMovieVolume .

A movie's tracks have their own volume settings. Use the SetTrackVolume function, described on SetTrackVolume , to set the volume of an individual track. A track's volume is scaled by the movie's volume to produce the track's final volume. Furthermore, the movie's volume is scaled by the sound volume that is returned by the Operating System's GetSoundVol routine (described in Inside Macintosh: More Macintosh Toolbox ). Thus, the user can control the overall volume from the Sound control panel.

ERROR CODES

invalidMovie

-2010

This movie is corrupted or invalid

SEE ALSO

When a movie is loaded, the current setting is set to preferred volume. The StartMovie function (described on StartMovie ) uses this volume setting when it starts playing a movie.


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next